package com.my.bigsite.modules.act.service;

import java.util.Date;
 




import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.my.bigsite.common.mybatis.MybatisDao;
import com.my.bigsite.modules.act.entity.Leave;

@Service
public class ActLeaveService {

	@Autowired
	private MybatisDao mybatisDao;  

    public Leave getLeave(Long id) {
        return mybatisDao.get("LeaveMapper.selectById",id);
    }

    @Transactional(readOnly = false)
    public void saveLeave(Leave entity) {
        if (entity.getId() == null) {
            entity.setApplyTime(new Date());
        }
        mybatisDao.insert("LeaveMapper.insert",entity);
    }
 

}
